-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#69] 쿠폰 수정 & 삭제 API , 쿠폰 배너 API 구현 #79
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생많으셨습니다!
|
||
const CouponBanner = () => { | ||
const headerAccommodation = useRecoilValue(headerAccommodationState); | ||
const sigunguData = headerAccommodation.sigungu; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이거 API없이 잘되었네요 👍..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
맞아요 다행입니다 ㅎㅎ
|
||
// 쿠폰 수정 | ||
export const useCouponUpdate = () => { | ||
const queryClient = useQueryClient(); | ||
return useMutation<void, Error, CouponUpdateCredential>({ | ||
mutationFn: couponUpdateApi, | ||
onSuccess: () => { | ||
queryClient.invalidateQueries({ queryKey: ['CouponList'] }); | ||
} | ||
}); | ||
}; | ||
|
||
// 쿠폰 삭제 | ||
export const useCouponDelete = () => { | ||
const queryClient = useQueryClient(); | ||
return useMutation<void, Error, CouponDeleteCredential>({ | ||
mutationFn: couponDeleteApi, | ||
onSuccess: () => { | ||
queryClient.invalidateQueries({ queryKey: ['CouponList'] }); | ||
} | ||
}); | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저희 useQueryHook은 모두 분리하는 방식으로 하는게 좋을까요
아니면 이렇게 한 파일에서 관리하는게 좋을까요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
둘 다 상관없지만 시간이 괜찮으시다면 기존 컨벤션처럼 분리하는게 좋은 것 같습니당
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 알겠습니다! 일단 머지한 후 현재 진행사항 마친 후 바로 분리 하겠습니다!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고하셨습니다~!!
@@ -2,8 +2,15 @@ import styled from '@emotion/styled'; | |||
import theme from '@styles/theme'; | |||
|
|||
import bannerIcon from '@assets/icons/ic-couponlist-speaker.svg'; | |||
import { useRecoilValue } from 'recoil'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { useRecoilValue } from 'recoil';
위 import는 상단으로 위치 이동해주시면 좋을 것같습니다!
import { | ||
CouponDeleteCredential, | ||
CouponListResponse, | ||
CouponToggleCredential, | ||
CouponUpdateCredential | ||
} from '@/types/couponList'; | ||
import { | ||
useMutation, | ||
useQueryClient, | ||
useSuspenseQuery | ||
} from '@tanstack/react-query'; | ||
import { | ||
couponDeleteApi, | ||
couponToggleApi, | ||
couponUpdateApi, | ||
getCouponList | ||
} from 'src/api/lib/getCouponList'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tanstack/react-query
@/types/couponList
'src/api/lib/getCouponList
import 개행 부탁드립니다~
if (conditionDays.length === 1) { | ||
return `${conditionDays}요일`; | ||
} else if (conditionDays === '평일') { | ||
return '일~목'; | ||
} else if (conditionDays === '주말') { | ||
return '금~토'; | ||
} | ||
return conditionDays; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
N요일, 평일, 주말
만 표현된다면 아래처럼 변경해보셔도 괜찮을 것같습니다!
if (conditionDays === '평일') {
return '일~목';
} else if (conditionDays === '주말') {
return '금~토';
}
return `${conditionDays}요일`;
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
앗 혹시 기본값은 전체로 와서 전체일 경우도 고려해서 작성한건데 다빈님 처럼 수정하는게 나을까요..?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제가 해당부분 인지를 정확히 하지 못하고있어서 그랬습니다 ㅜㅜ
전체 라는 값이 있다면 진주님 방식 그대로 해주시는게 더 좋을 것같습니다!!
status?: string, | ||
title?: string | ||
) => | ||
useSuspenseQuery<CouponListResponse, Error>({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
쿼리 사용해서 잘 구현해주셨네요. 도움 많이 받고 갑니다 !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
감사합니다!
close #69
Description
유의할 점 및 ETC (Optional)
스크린샷 (Optional)